<?php
$config = include_once('../../public/config/config.php');
include_once('../../public/func/db.php');
$array = array(
	'title' => '名称',
	'describe' => '描述',
);
foreach($_POST as $k=>$v){
	if(!$v){
		echo '<script>alert("'.$array[$k].'不能为空");window.location.href="/admin/category/add.php"</script>';
	}
}
$_POST['ctime'] = time();
$res = insert($config,'category',$_POST);
if($res == ''){
	echo '<script>alert("添加成功");window.location.href="/admin/category/index.php"</script>';
}else{
	echo '<script>alert("添加失败");window.location.href="/admin/category/add.php"</script>';
}